from tortoise.models import Model
from tortoise import fields


class SysDept(Model):
    dept_id = fields.IntField(pk=True, description="部门ID", generated=True, comment="部门id")
    parent_id = fields.IntField(description="父部门ID", default=0, comment="父部门id")
    ancestors = fields.CharField(max_length=50, description="祖级列表", default="", comment="祖级列表")
    dept_name = fields.CharField(max_length=30, description="部门名称", comment="部门名称")
    order_num = fields.IntField(description="显示顺序", default=0, comment="显示顺序")
    leader = fields.CharField(max_length=20, description="负责人", null=True, default="", comment="负责人")
    phone = fields.CharField(max_length=11, description="联系电话", null=True, default="", comment="联系电话")
    email = fields.CharField(max_length=50, description="邮箱", null=True, default="", comment="邮箱")
    status = fields.CharField(max_length=1, description="部门状态", null=True, default="0", comment="部门状态")
    del_flag = fields.CharField(max_length=1, description="删除标志", null=True, default="0", comment="删除标志")
    create_by = fields.CharField(max_length=64, description="创建者", null=True, default="", comment="创建者")
    create_time = fields.DatetimeField(auto_now_add=True, description="创建时间", null=True, comment="创建时间")
    update_by = fields.CharField(max_length=64, description="更新者", default="", null=True, comment="更新者")
    update_time = fields.DatetimeField(auto_now=True, description="更新时间", null=True, comment="更新时间")

    class Meta:
        table = "sys_dept"
        table_description = "部门表"

